import BH3MysApi from "./mysApi.js"
import base from "./base.js"
import mysCfg from "./mysCfg.js"
export default class MonthInfo extends base {
  constructor(e) {
    super(e)
    this.model = "MonthInfo"
  }

  async getData(e, set = false) {
    let { uid, ck, game_biz, region } = await mysCfg.othergame(e)
    let mysApi = new BH3MysApi(uid, ck, { game: "bh3" }, region, game_biz)
    let device_fp = await mysApi.getData("getFp")
    let headers = { "x-rpc-device_fp": device_fp?.data?.device_fp }
    let api = set === true ? "MonthInfo" : "LastMonthInfo"
    let res = await mysApi.getBH3ApiData(api, { headers })
    let data = res.data
    let icon = ['3-3.a09d578e', '2-3.598665ca', '1-3.5ff44116', '3-2.7358f84a', '2-2.b56a1a44', '1-2.95254c84', '3-1.cfafe0e1', '2-1.83a6d5c8',
      '1-1.36af5d61', '1.9f988406'
    ]
    const randomIndex = Math.floor(Math.random() * icon.length)
    const icon_url = icon[randomIndex]
    let juese = ['Senadina', 'Helia', 'Coralie']
    const jueserandomIndex = Math.floor(Math.random() * juese.length)
    const juese_url = juese[jueserandomIndex]
    return { ...this.screenData, data, icon_url, juese_url}
  }
}
